package com.shujia.indicators.core;

import com.shujia.indicators.utils.SparkUtils;
import org.apache.spark.sql.Dataset;
import org.apache.spark.sql.Row;
import org.apache.spark.sql.SaveMode;
import org.apache.spark.sql.SparkSession;

public class HotWordEtl {
    public static void main(String[] args) {
        SparkSession sparkSession = SparkUtils.initSession();

        Dataset<Row> dataset = sparkSession.sql("select feedback_content from bigdata005_user_portraits_dwd.dwd_t_feedback");

        dataset.write().format("jdbc")
                .mode(SaveMode.Append)
                .option("url","jdbc:mysql://localhost:3306/bigdata005")
                .option("dbtable","HotWord")
                .option("user","bigdata005")
                .option("password","ShuJia666777...")
                .option("driver","com.mysql.jdbc.driver")
                .save();
    }
}
